// Vue全局方法
/* eslint-disable */
const base = {}
base.install = function(Vue,option){
  Vue.prototype.s_alert = function (txt, time) {
    time = time ? time : 1700;
    this.$store.commit('setMessageDialogObj',{
      visible: true,
      time: time,
      txt: txt
    })
  },
  Vue.prototype.scrollNews = function (obj,num) {
    var $self = obj.find("ul:first");
    let lineHeight
    if (num && num > 1) {
      lineHeight = $self.find("li:first").height()*num;
    } else {
      lineHeight = $self.find("li:first").height()
    }
    $self.animate({
        "margin-top": -lineHeight + "px"
      },
      600,
    function(){
      if (num && num > 1) {
        for( let i = 0; i < num; i++) {
          $self.css({
            "margin-top": "0px"
          }).find("li:first").appendTo($self);
        }
      } else {
        $self.css({
          "margin-top": "0px"
        }).find("li:first").appendTo($self);
      }

    })
  }
}
export default base

